#pragma once

#include "Ability/EditorAbilityViewModel.h"
#include "EditorBreakpointAbilityModel.h"
#include "Math/Color.h"
#include "EditorBreakpointAbilityViewModel.m.h"

class REditorScriptDebugSubsystem;
class REditorBreakpointAbilityModel;

RCLASS()
class REditorBreakpointAbilityViewModel : public REditorAbilityViewModel
{
    ROBJECT

public:
    void BindModel(TSharedObjectPtr<REditorAbilityModel> InModel) override;
    virtual TSharedObjectPtr<RTexture2D> GetIcon() const override;
    virtual TSharedObjectPtr<RTexture2D> GetHighlightIcon() const override;

protected:
    TWeakObjectPtr<REditorBreakpointAbilityModel> BreakpointModel;
    TSharedObjectPtr<RTexture2D> Icon;
    TSharedObjectPtr<RTexture2D> HighlightIcon;
    
    TSharedObjectPtr<REditorScriptDebugSubsystem> BreakpointSubsystem;
public:

    int64_t GetBreakpointNumber() const;
    bool IsBreakpointEnabled(int64_t InBreakpointIndex) const;
    void TogglerBreakpointEnabled(int64_t InBreakpointIndex);
    CString GetBreakpointFileName(int64_t InBreakpointIndex) const; 
    CString GetBreakpointFilePath(int64_t InBreakpointIndex) const;
    int64_t GetBreakpointLine(int64_t InBreakpointIndex) const;
    void RemoveBreakpoint(int64_t InBreakpointIndex);

    const float LineHeight = 20.0f;
    SColor GetBreakpointColor(int64_t InBreakpointIndex);

    TDelegate<void> OnBreakpointAdded;
    TDelegate<void> OnBreakpointRemoved;

};